package com.tehui.activity.impl;

import android.content.Intent;

import com.tehui.R;
import com.tehui.activity.BaseActivity;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;

import butterknife.BindView;

public class WebActivity extends BaseActivity {

    @BindView(R.id.webView)
    WebView  webView;

    @Override
    public void initActivityData() {
        super.initActivityData();
        tvTitle.setText("详情");

        Intent intent = getIntent();
        String url = intent.getStringExtra("url");

        String urlt = "http://www.baidu.com";

        // 设置可以支持缩放
        webView.getSettings().setSupportZoom(true);
        //扩大比例的缩放
        webView.getSettings().setUseWideViewPort(true);
        //自适应屏幕
        webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        webView.getSettings().setLoadWithOverviewMode(true);

        webView.setWebViewClient(client);
        webView.loadUrl(urlt);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_web;
    }

    private WebViewClient client = new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    };
}
